All Questions
Tagged with htmltext-processing
63 questions
0votes
2answers
89views
BSD sed/awk moving portion of line to line above (switching attribute in HTML file)
My situation is simple : I have an HTML file with several lines containing only the indented <section> block tag, each line followed by an (also indented) <h3 id="YYYY">...</...
1vote
3answers
112views
sed: To match a newline and spaces
I have a following file: <head> <title>this is a title</title> <style> here goes a style sheet </style> </head> I need to strip the <title> element ...
1vote
3answers
185views
Command or script to delete all text in between two flags (html tags), in all files in a directory?
I have a directory full of html files that all have certain tags that I want deleted. For instance, in all files I have <p class="message"> </p> that I want gone, but the text ...
1vote
1answer
452views
Substitution in html file using awk
My awk script reads records from file1, finds the same records in file2 and substitutes alternate positions (of the record) with a defined symbol in that. But few of the values are not getting ...
0votes
1answer
127views
Append multiline html section to the top and bottom of html files
what is the most handy way to append multiline html block to the top of html pages in the directory? I have a multiple XHTML files in directory, without a heading part and without closing tags at the ...
0votes
3answers
266views
How do I get sed to delete the second block of lines in a file?
I have hundreds of badly-written HTML files that have two HTML sections, like this: <HTML> <HEAD> several header lines </HEAD> <BODY> hundreds of lines of content </BODY> ...
1vote
1answer
367views
How to remove part of line from HTML file
I have a file, events.html, containing similar lines (among many other): <td class="EventDate">2021-08-06 12:36:34</td> where date and time strings are different in each line. ...
1vote
2answers
2kviews
how to convert plaintext to html with clickable links
how can i convert plaintext files containing a bunch of urls to html with clickable links? preferably on the command line. every once in a while i end up with a plaintext file containing a bunch of ...
-2votes
4answers
3kviews
Simple way to get extract data from HTML
After I retrieved a web page with curl -X POST http://example.com/data/123 I got this response: <td><a href="http://help.example.com " target="_blank">help.example.com</a></td&...
0votes
2answers
6kviews
Bold a text in Bash
I have a sample script here I want to bold the word BOLD in the text and send through email. Tried several ways but not seems to working. BODY="Hello. I want to BOLD this" { echo "From: from@...
1vote
1answer
115views
inplace file replacement for nth pattern match
I have a file with many lines but I can summarise my requirements like below: <DT><A HREF="http://127.0.0.1:1234/ABCDE/wp-admin/index.cfm?event&msg=secure&fr=sp">...
-1votes
1answer
68views
How to Search & Replace a phrase in many HTML files at once? (Using a terminal)
How to delete the words "display:none;" from 100 html files at once?
0votes
3answers
245views
extract specific words and its data from html/xml file
sample input is <bre rt="1600" et="1550794901464" st="1550794899864" tid="8390500116294391399" mh="N" cn="" lc="" ts="N/A" cidc="" IDC="" eidc="BRE-S-TRA-0085418501"/> <r1> &...
-1votes
2answers
1kviews
Return the next 50 characters after a string is found in a file
I'm pretty terrible with regex and searching for patterns, so I don't really know where to start. I need to find <td id="latest_button"> in test.txt and return the next 50 characters after it. ...
1vote
1answer
119views
Placing the last line first in each html <ul> with sed
I try to place the line "name: *****" just after the corresponding (innermost containing) "ul" each time an "ul" appears, so that it looks like this: Before: <ul> <ul> <li ...